import jdk.internal.org.objectweb.asm.tree.MultiANewArrayInsnNode;

import java.io.*;
import java.util.Scanner;

public class IO2 {
    public static Scanner scan=new Scanner(System.in);
    public static void main(String[] args) {
        System.out.println("请输入想要想要复制的文件：");
        String wen=scan.next();
        File file=new File(wen);
        if(!file.isFile())
        {
            System.out.println("文件不存在");
            return;
        }
        System.out.println("请输入文件复制到的路径");
        String lu=scan.next();
        File filelu=new File(lu);
        if(filelu.isFile())
        {
            System.out.println("您当前输入的目标路径有误");
            return;

        }
        try(InputStream inputStream=new FileInputStream(wen); OutputStream outputStream=new FileOutputStream(lu))
        {
            while(true)
            {
                int a=inputStream.read();
                if(a==-1)
                {
                    break;

                }
                outputStream.write(a);
            }
            System.out.println("复制文件成功");

        }catch(IOException e)
        {
            e.printStackTrace();
        }


    }
}
